package wci.frontend.pascal;

/**
 * <h1>PascalErrorCode</h1>
 *
 * <p>Pascal 翻译错误编码</p>
 *
 * <p>Copyright (c) 2009 by Ronald Mak</p>
 * <p>For instructional purposes only.  No warranties.</p>
 */
public enum PascalErrorCode
{
    ALREADY_FORWARDED("已在FORWARD中指定"),
    CASE_CONSTANT_REUSED("重用CASE常量"),
    IDENTIFIER_REDEFINED("重定义的identifier"),
    IDENTIFIER_UNDEFINED("未定义identifier"),
    INCOMPATIBLE_ASSIGNMENT("不兼容的赋值"),
    INCOMPATIBLE_TYPES("不兼容的类型"),
    INVALID_ASSIGNMENT("无效的赋值语句"),
    INVALID_CHARACTER("非法字符"),
    INVALID_CONSTANT("无效的常量"),
    INVALID_EXPONENT("非法指数"),
    INVALID_EXPRESSION("非法表达式"),
    INVALID_FIELD("非法域(field)"),
    INVALID_FRACTION("非法小数"),
    INVALID_IDENTIFIER_USAGE("不正确的identifier使用"),
    INVALID_INDEX_TYPE("非法索引类型"),
    INVALID_NUMBER("无效数值"),
    INVALID_STATEMENT("非法语句"),
    INVALID_SUBRANGE_TYPE("非法的subrange类型"),
    INVALID_TARGET("无效的赋值目标"),
    INVALID_TYPE("非法类型"),
    INVALID_VAR_PARM("非法的VAR参数"),
    MIN_GT_MAX("最小限制数大于最大限制数"),
    MISSING_BEGIN("缺失BEGIN"),
    MISSING_COLON("缺失冒号 :"),
    MISSING_COLON_EQUALS("缺失赋值符 :="),
    MISSING_COMMA("缺失逗号 ,"),
    MISSING_CONSTANT("缺失常量"),
    MISSING_DO("缺失 DO"),
    MISSING_DOT_DOT("缺失范围符号 .."),
    MISSING_END("缺失 END"),
    MISSING_EQUALS("缺失比较符 ="),
    MISSING_FOR_CONTROL("无效的FOR控制标量"),
    MISSING_IDENTIFIER("缺失identifier"),
    MISSING_LEFT_BRACKET("缺失正方括号 ["),
    MISSING_OF("缺失  OF"),
    MISSING_PERIOD("缺失句号 ."),
    MISSING_PROGRAM("缺失 PROGRAM"),
    MISSING_RIGHT_BRACKET("缺失反方括号 ]"),
    MISSING_RIGHT_PAREN("缺失反括号 )"),
    MISSING_SEMICOLON("缺失分号 ;"),
    MISSING_THEN("缺失 THEN"),
    MISSING_TO_DOWNTO("缺失 TO 或 DOWNTO"),
    MISSING_UNTIL("缺失 UNTIL"),
    MISSING_VARIABLE("缺失变量"),
    NOT_CONSTANT_IDENTIFIER("不是一个常量标识(identifier)"),
    NOT_RECORD_VARIABLE("不是一个record变量"),
    NOT_TYPE_IDENTIFIER("不是一个类型标识(identifier)"),
    RANGE_INTEGER("整数超过范围"),
    RANGE_REAL("实数操作范围"),
    STACK_OVERFLOW("栈溢出"),
    TOO_MANY_LEVELS("嵌套层数太多"),
    TOO_MANY_SUBSCRIPTS("太多下标"),
    UNEXPECTED_EOF("意外的终止符"),
    UNEXPECTED_TOKEN("意外的token"),
    UNIMPLEMENTED("未实现的特性"),
    UNRECOGNIZABLE("不能识别的输入"),
    WRONG_NUMBER_OF_PARMS("实参数量不对"),

    // Fatal errors.
    IO_ERROR(-101, "对象 I/O 错误"),
    TOO_MANY_ERRORS(-102, "太多语法错误");

    private final int status;      // 推出状态
    private final String message;  // 错误消息
    
    PascalErrorCode(String message)
    {
        this.status = 0;
        this.message = message;
    }
    PascalErrorCode(int status, String message)
    {
        this.status = status;
        this.message = message;
    }
    public int getStatus()
    {
        return status;
    }
    public String toString()
    {
        return message;
    }
}
